<?php 
if(!defined('__WM__')) die('Error');# Definicion de seguridad
if(!isset($_GET['ver'])&&!isset($_GET['archivar'])&&!isset($_GET['eliminar'])){
$result = @mysql_query("SELECT * FROM wmb_contacto ORDER BY fecha DESC");
?>
<div><label class='titulo'>Contacto<br /></label><br />

<table width="400" border="0" cellpadding="0" cellspacing="0" class="tabla">
  <tr class="headers">
    <th width="198" height="28">Nombre</td>
    <th>Motivo</td>
    <th>Fecha</td>
  </tr>
<?php
while ($row = @mysql_fetch_array($result, MYSQL_ASSOC)){
echo "<tr>
    <td height='12' onmousemove=\"document.getElementById('contacto_".$row['id']."').style.visibility='visible';\" onmouseout=\"document.getElementById('contacto_".$row['id']."').style.visibility='hidden';\">".$row['nombre']."<div id='contacto_".$row['id']."'><a href='?modulo=contacto&ver&id=".$row['id']."' class='link-blue'>Ver</a> | <a href='' class='link-green'>Archivar</a> | <a href='' class='link-red'>Eliminar</a></div>
	</td>
    <td width='220px'>".$row['motivo']."</td>
    <td> ".date('d-m-Y h:i:s',strtotime($row['fecha']))."</td>
  </tr>";
}
?>
  <tr class="headers">
    <th width="198" height="28">Nombre</td>
    <th>Motivo</td>
    <th>Fecha</td>
  </tr>
</table>
<?
}elseif(!empty($_GET['id'])){
	$id=(int)$_GET['id'];
	if(isset($_GET['ver'])){
	?>
    <table width="400" border="0" cellpadding="0"  cellspacing="0" class="tabla" style="font-size:14px;">
      <tr class="headers" width="198" height="28">
      <th colspan="2" style="text-align:center">Ficha de contacto</th>
    </tr>
    <?
		$result = @mysql_query("SELECT * FROM wmb_contacto WHERE id =".$id." LIMIT 1");
		if(!$row = @mysql_fetch_assoc($result)) echo "Error 404";
        echo"<tr><td  height=25 >Nombre : </td><td><b>".$row['nombre']."</b></td></tr>
		<tr><td  height=25 >E-Mail : </td><td><b>".$row['email']."</b></td></tr>
		<tr><td  height=25 >Pagina web : </td><td><b>".$row['paginaweb']."</b></td></tr>
		<tr><td  height=25 >Telefono : </td><td><b>".$row['telefono']."</b></td></tr>
		<tr><td  height=25 >Motivo : </td><td><b><u>".$row['motivo']."</u></b></td></tr>
		<tr><td  height=25 colspan=2 style=text-align:center >Mensaje : </td></tr>
		<tr><td colspan=2 style=padding:5px ><b>".$row['mensaje']."</b></td></tr>";
	?>
    </table>
    <?
	}

}
?>
